package exercise1;
import java.util.Scanner;
public class No3_9 {
    public static void main(String []args)
    {
        System.out.println("Enter the first 9 digits of an ISBN as integer: ");
        Scanner input = new Scanner(System.in);
        long digits=input.nextLong();
        long digits_c=digits;
        int d9= (int) (digits%10);
        digits=(int)(digits/10);
        int d8= (int) (digits%10);
        digits=(int)(digits/10);
        int d7= (int) (digits%10);
        digits=(int)(digits/10);
        int d6= (int) (digits%10);
        digits=(int)(digits/10);
        int d5= (int) (digits%10);
        digits=(int)(digits/10);
        int d4= (int) (digits%10);
        digits=(int)(digits/10);
        int d3= (int) (digits%10);
        digits=(int)(digits/10);
        int d2= (int) (digits%10);
        digits=(int)(digits/10);
        int d1= (int) (digits%10);


        int d10=(d1*1+d2*2+d3*3+d4*4+d5*5+d6*6+d7*7+d8*8+d9*9)%11;
        if (d10!=10)
        {
            System.out.println("The ISBN-10 number is "+(digits_c*10+d10));
        }
        else
        {
            System.out.println("The ISBN-10 number is "+digits_c+"x");
        }
    }
}
